<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            position: relative;
            width: 200px;
            height: 200px;
            
            transform-style: preserve-3d;
            transition: all .6s;  
            margin: 200px auto;
        }
        .box:hover{
            transform: rotateX(90deg);
        }
        .a,.b{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;

        }
        .a{
            background-color: pink;
            transform: translateZ(100px);
        }
        .b{
            background-color: blue;
            transform: translateY(100px)  rotateX(-90deg);
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="a">1</div>
        <div class="b">1</div>
    </div>
</body>
</html>